import java.util.Scanner;

public class Avg2 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double sum = 0, score;

		boolean inputOk = true;// 假定没有错误输入
		for (int i = 1; i <= 5; i++) {
			System.out.println("请输入" + i + "门课的成绩：");
			score = sc.nextDouble();
			if (score < 0) {
				inputOk = false;
				break;
			}
			sum = sum + score;
		}
		// 区分是正常的循环退出还是有异常提前退出
		// 正常退出，inputOk=true,否则等于false
		if (inputOk) {
			double avg = sum / 5;
			System.out.printf("平均分是%7.2f", avg);
		} else {
			System.out.println("输入成绩错误！");
		}
	}
}
